<template>
	<loading-wait v-if="loading" ></loading-wait>
	<view class="uni-global-box" >
		<view class="uni-global-title">
			系统设置 / 地区管理 / 新增地区
		</view>
		<view class="body">
			<u-form :model="form" ref="form1" class="u-form" label-width="0" >
				<view class="u-form-textInput">
					<view class="u-form-name">
					</view>
					<u-form-item prop="content" :border-bottom="false">
						<webEdit v-model="form.content" ids="content"  style="width:1000px;"></webEdit>
					</u-form-item>
				</view>
				<view class="u-form-textInput">
					<view class="u-form-name">
						是否显示
					</view>
					<u-form-item prop="sort" :border-bottom="false">
						<u-form-item label="" prop="radio"  :border-bottom="false">
							<u-radio-group v-model="form.type"  >
								<u-radio v-for="(item, index) in radioList1" :key="index" :name="item.value"
									:disabled="item.disabled">
									{{ item.name }}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-form-item>
				</view>
				<u-button @click="submit" type="primary" >提交</u-button>
			</u-form>
		</view>
		
	</view>
	<u-toast ref="uToast" ></u-toast>
</template>

<script>
	import {rules,radioList1} from "/common/js_file/term.js" ;
	const global = uniCloud.importObject("global",{customUI:true});
	export default {
		data() {
			let form = {
				"content":'',
				"type":1
			}
			return {
				loading:false,
				form,
				rules,
				radioList1,
				uid:'',
			};
		},
		onLoad() {
		},
		methods: {
			submit() {
				this.$refs.form1.validate(valid => {
					if (valid) {
						this.loading = true;
						this.add( this.form );
					} else {
						
					}
				});
			},
			add(form){
				// return console.log(form);
				global.addData('term',form).then(res =>  {
					this.loading = false;
					this.$refs.uToast.show({
						title: '添加成功',type: 'success',duration:500,
						position:'top',url: '/pages/system/term/term'
					})
				})
			},
			goUrl(Url){
				uni.navigateTo({url:Url})
			}
		},
		onReady() {
			this.$refs.form1.setRules(this.rules);
		}
	}
</script>

<style lang="scss">
	.body{
		width: 50%;
	}
</style>
